﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="Stock.aspx.cs" Inherits="Admin_Stock" Title="Stock List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Stock List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <data:GridViewSearchPanel ID="GridViewSearchPanel1" runat="server" GridViewControlID="GridView1"
        PersistenceMethod="Session" />
    <br />
    <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
        DataSourceID="StockDataSource" DataKeyNames="StockId" AllowMultiColumnSorting="False"
        DefaultSortColumnName="[Quantity]" DefaultSortDirection="Ascending" 
        ExcelExportFileName="Export_Stock.xls" AllowExportToExcel="True" 
        AllowPaging="True" AllowSorting="True" ExportToExcelText="Excel" 
        PageSelectorPageSizeInterval="10" RecordsCount="0" ShowGridOnEmptyData="False">
        <Columns>
            <asp:BoundField DataField="DrugId" HeaderText="Drug Id" SortExpression="[DrugId]"/>            
            <data:HyperLinkField HeaderText="Drug Id" DataNavigateUrlFormatString="DrugDispoEdit.aspx?DrugId={0}"
                DataNavigateUrlFields="DrugId" DataContainer="DrugIdSource" DataTextField="DrugName" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]"
                DataFormatString="{0:#,##0}">
                <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="[UnitPrice]"
                DataFormatString="{0:#,##0}">
                <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            <asp:BoundField DataField="ExpDate" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="Exp Date"
                SortExpression="[ExpDate]" />
            <asp:BoundField DataField="BatchLot" HeaderText="Batch Lot" SortExpression="[BatchLot]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Stock Found!</b>
        </EmptyDataTemplate>
        <PagerSettings PageButtonCount="5" />
    </data:EntityGridView>
    <br />
    <data:StockDataSource ID="StockDataSource" runat="server" SelectMethod="GetPaged"
        EnablePaging="True" EnableSorting="True" EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:StockProperty Name="DrugDispo" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
            <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                Type="Int32" />
            <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                Type="Int32" />
            <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
        </Parameters>
    </data:StockDataSource>
</asp:Content>
